import request from '@/utils/request'

const api_name = 'roomType'

export default {

  // 编写方法，向服务器发送请求
  search(searchMap) {
    return request({
      url: `${api_name}/list`,
      method: 'post',
      data: searchMap

    })
  },
  update(id, pojo) {
    if (id === null || id === '') {
      // 新增
      return this.save(pojo)
    }
    return request({
      url: `${api_name}/update`,
      method: 'put',
      data: pojo
    })
  },
  deleteById(id) {
    return request({
      url: `/${api_name}/delete/` + id,
      method: 'delete'
    })
  },
  findById(id) {
    return request({
      url: `${api_name}/find/` + id,
      method: 'get'
    })
  },
  all() {
    return request({
      url: `${api_name}/all`,
      method: 'get'
    })
  },
  save(pojo) {
    return request({
      url: `${api_name}/add`,
      method: 'post',
      data: pojo
    })
  },
  deleteByIds(ids) {
    return request({
      url: `${api_name}/deleteByIds`,
      method: 'delete',
      data: ids
    })
  }

}
